package main

import (
	"context"
	"os"
	"os/signal"
	"syscall"
	"week13/internal/job"
	"week13/internal/job/handler"
)
var signs chan os.Signal
var consumer job.ConsumeMessage
func main() {
	signs = make(chan os.Signal, 1)
	ctx, cancel := context.WithCancel(context.Background())
	signal.Notify(signs, syscall.SIGINT, syscall.SIGTERM)
	go func() {
		select {
		case <-signs:
			cancel()
		}
	}()
	handler := handler.IncomeCreateJob{}
	consumer =job.NewKafkaConsumer("deal-create-income",[]string{job.TOPIC_DEAL_FINISH},handler)
	consumer.Consume(ctx)
}
